import java.util.Scanner;
import java.util.Stack;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();

        Stack<Character> stack = new Stack<>();

        stack.push(str.charAt(0));
        for(int i = 1;i < str.length();i ++){
            if(stack.isEmpty() || str.charAt(i) != stack.peek()){
                stack.push(str.charAt(i));
            }else{
                stack.pop();
            }
        }
        String s = stack.toString();
        if(s.isEmpty()){
            System.out.print("0");
        }else{
            for(int i = 0;i < s.length();i ++){
                if(Character.isLetter(s.charAt(i))){
                    System.out.print(s.charAt(i));
                }
            }
        }
    }
}